/*
 Copyright 2008 Jason E. Smith Licensed under the Apache License, Version 2.0 (the "License"); 
 You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0
 */
/*
 * see: http://www.chrisesler.com/mootools/fisheye/fisheyeInviz.php
 */
DockBar = namespace("controls::DockBar", {
	"@inherits" : Widget,
	
	minZoom : 54,
	maxZoom : 128,
	zoomQty : 5,
	
	initialize: function() {
		this.handle = this.element;
		this.items = this.getElements('img');
		this.handle.setStyle('margin-left', '-' + (this.handle.offsetWidth/2) + 'px');
		this.effects = [];
		this.items.each(function(el) {
			el.addEvent('mouseover', this.magnify.bind(this));
			el.addEvent('mouseout', this.shrink.bind(this));
			this.effects[el.src] = $(el.parentNode);
		}, this);
	},
	magnify: function(el) {
		this.effects[el.target.src].set('morph', {duration: 50});
		this.effects[el.target.src].morph({
			'height': this.maxZoom + 'px',
			'width': this.maxZoom + 'px',
			'margin-top': '-' + (this.maxZoom - el.target.getStyle('height').toInt()) + 'px',
		});
	},
	shrink: function(el) {
		this.effects[el.target.src].set('morph', {duration: 400});
		this.effects[el.target.src].morph({
			'height': this.minZoom + 'px',
			'width': this.minZoom + 'px',
			'margin-top': '0px',
		})
	}
});